const api = require("../../../../utils/api")
const getwxphone = require("../../../../utils/getwxphone")

Page({

  /**
   * 页面的初始数据
   */
  data: {},


  onLoad: function (options) {

    if (options.area) {
      api.load(options)
    }
    const phone = wx.getStorageSync('51629phone')
    if (phone) {
      wx.navigateTo({
        url: '../index/index',
      })
    }
  },

  getPhoneNumber(e) {
    var _ = this;
    const info = {
      area: wx.getStorageSync('area'),
      agent: wx.getStorageSync('agent'),
      page: wx.getStorageSync('page'),
      activeId: 42
    }

    getwxphone(e.detail.code, 51629, 'biaodan', info)
      .then(res => {
        console.log(res);
        wx.navigateTo({
          url: '../index/index',
        })
      })
      .catch(err => {
        console.log(err);
      })
  },



  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    const area = wx.getStorageSync('area')
    const agent = wx.getStorageSync('agent')
    const page = wx.getStorageSync('page')
    return {
      title: '2023国考考前加油包',
      path: 'pages/gk/xczl/login/login?area=' + area + '&agent=' + agent + '&page=' + page
    }
  },
  /**分享到朋友圈*/
  onShareTimeline: function () {
    const area = wx.getStorageSync('area')
    const agent = wx.getStorageSync('agent')
    const page = wx.getStorageSync('page')
    return {
      title: '2023国考考前加油包',
      path: 'pages/gk/xczl/login/login?area=' + area + '&agent=' + agent + '&page=' + page
    }
  }
})